package top.lshaci.learning.alibaba.cloud.seata.storage.api;

import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.lshaci.learning.alibaba.cloud.seata.storage.service.StorageService;

/**
 * StorageController
 *
 * @author lshaci
 * @since 1.0.0
 */
@RestController
@AllArgsConstructor
@RequestMapping("/storage")
public class StorageController {

    private final StorageService storageService;

    /**
     * 从用户账户中借出
     */
    @GetMapping("/deduct/{commodityCode}/{count}")
    public void debit(@PathVariable String commodityCode, @PathVariable int count) {
        storageService.deduct(commodityCode, count);
    }
}
